package com.example.websocketleaning;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import java.net.URI;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        URI uri=URI.create("ws://echo.websocket.org");
        JWebSocketClient client = new JWebSocketClient(uri){
            @Override
            public void onMessage(String message) {
                Log.d(TAG, "onMessage: "+message);
            }
        };
        try {
            client.connectBlocking();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}